<?php echo $this->Html->script('jquery.validate', array('inline' => false));?>

<?php echo $this->Form->create('User', array('url' => array('controller' => 'users', 'action' => 'login'), 'class' => 'form-horizontal', 'id' => 'login-form')); ?>
<div class="control-group">
	<label class="control-label">User Name</label>
	<div class="controls">
		<div class="input-prepend">
			<span class="add-on"><i class="icon-user"></i></span>
			<?php echo $this->Form->input('user_name', array(
				'class' => 'input-xlarge', 
				'id' => 'uname', 
				'placeholder' => 'User Name', 
				'div' => false,
				'label' => false));?> 
		</div>
	</div>
</div>
<div class="control-group">
	<label class="control-label">Password</label>
	<div class="controls">
		<div class="input-prepend">
			<span class="add-on"><i class="icon-lock"></i></span>
			<?php echo $this->Form->input('password', array(
				'class' => 'input-xlarge',
				'type' => 'password', 
				'id' => 'passwd', 
				'placeholder' => 'Password', 
				'div' => false,
				'label' => false));?> 
		</div>
	</div>
</div>
<div class="control-group">
	<label class="control-label" for="input01"></label>
    <div class="controls">
       <?php echo $this->Form->submit('Login', array('class' => 'btn btn-success', 'div' => false));?>
    </div>
</div>
	
<?php echo $this->Form->end();?>

<?php 
	echo $this->Html->link(
		'Sign Up', 
		array('controller' => 'users', 'action' => 'register'),
		array('class' => 'btn btn-info')); 
?>

<script type="text/javascript">
$(document).ready(function() {
	$("#login-form").validate({
		rules: {
			"data[User][user_name]": {
				required: true
				},
			"data[User][password]": {
				required: true
				}
		},
		errorClass: "help-inline"
		});
});
</script>